<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotAxes extends Application_Model_ModelAbstract
{

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IdPILOTAXES;



    /**
     * Dependent relation fk_PILOT_AXEACTIVITE_PILOT_AXES1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotAxeactivite
     */
    protected $_PilotAxeactivite;

    /**
     * Dependent relation fk_PILOT_DEFCOLUMN_PILOT_AXES1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotDefcolumn
     */
    protected $_PilotDefcolumn;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_AXES'=>'IdPILOTAXES',
        ));

        $this->setParentList(array(
        ));

        $this->setDependentList(array(
            'FkPILOTAXEACTIVITEPILOTAXES1' => array(
                    'property' => 'PilotAxeactivite',
                    'table_name' => 'PilotAxeactivite',
                ),
            'FkPILOTDEFCOLUMNPILOTAXES1' => array(
                    'property' => 'PilotDefcolumn',
                    'table_name' => 'PilotDefcolumn',
                ),
        ));
    }

    /**
     * Sets column idPILOT_AXES
     *
     * @param string $data
     * @return Application_Model_PilotAxes
     */
    public function setIdPILOTAXES($data)
    {
        $this->_IdPILOTAXES = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_AXES
     *
     * @return string
     */
    public function getIdPILOTAXES()
    {
        return $this->_IdPILOTAXES;
    }

    /**
     * Sets dependent relations fk_PILOT_AXEACTIVITE_PILOT_AXES1
     *
     * @param array $data An array of Application_Model_PilotAxeactivite
     * @return Application_Model_PilotAxes
     */
    public function setPilotAxeactivite(array $data)
    {
        $this->_PilotAxeactivite = array();

        foreach ($data as $object) {
            $this->addPilotAxeactivite($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_AXEACTIVITE_PILOT_AXES1
     *
     * @param Application_Model_PilotAxeactivite $data
     * @return Application_Model_PilotAxes
     */
    public function addPilotAxeactivite(Application_Model_PilotAxeactivite $data)
    {
        $this->_PilotAxeactivite[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_AXEACTIVITE_PILOT_AXES1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotAxeactivite
     */
    public function getPilotAxeactivite($load = true)
    {
        if ($this->_PilotAxeactivite === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTAXEACTIVITEPILOTAXES1', $this);
        }

        return $this->_PilotAxeactivite;
    }

    /**
     * Sets dependent relations fk_PILOT_DEFCOLUMN_PILOT_AXES1
     *
     * @param array $data An array of Application_Model_PilotDefcolumn
     * @return Application_Model_PilotAxes
     */
    public function setPilotDefcolumn(array $data)
    {
        $this->_PilotDefcolumn = array();

        foreach ($data as $object) {
            $this->addPilotDefcolumn($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_DEFCOLUMN_PILOT_AXES1
     *
     * @param Application_Model_PilotDefcolumn $data
     * @return Application_Model_PilotAxes
     */
    public function addPilotDefcolumn(Application_Model_PilotDefcolumn $data)
    {
        $this->_PilotDefcolumn[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_DEFCOLUMN_PILOT_AXES1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotDefcolumn
     */
    public function getPilotDefcolumn($load = true)
    {
        if ($this->_PilotDefcolumn === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTDEFCOLUMNPILOTAXES1', $this);
        }

        return $this->_PilotDefcolumn;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotAxes
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotAxes());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotAxes::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTAXES() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_AXES = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTAXES()));
    }
}
